package com.k.kpp.web.controller;

import com.k.kpp.service.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class MybatisController {
    @Autowired
    private CommonService commonServiceImpl;
    @RequestMapping("/common/post")
    @ResponseBody
    public Map<String, Object> commonMgr( @RequestBody Map<String, Object> conditions) {

        List<Map<String, Object>> sqlData = commonServiceImpl.executeSql("select * from users");
        List<Map<String, Object>> mapData = commonServiceImpl.selectList(conditions);
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("sqlData", sqlData);
        resultMap.put("mapData", mapData);
        return resultMap;
    }
}
